<?php
namespace app\index\service;


use app\index\model\ContractBuyModel;
use app\index\model\ContractCaiJieModel;
use app\index\model\ContractCaiModel;
use app\index\model\StuffRuModel;

class ZhiService extends CommonService
{
    public function get_zhi_xiang_yiju(){
        return [
            'cai'=>'支出合同',
            'caijie'=>'支出合同结算单',
            'buy'=>'采购单',
            'stuffru'=>'入库单',
            'none'=>'无',
        ];
    }
    public function get_zhi_xiang_yiju_name($yiju){
        $arr = $this->get_zhi_xiang_yiju();
        return isset($arr[$yiju]) ? $arr[$yiju] : '';
    }
    public function get_zhi_xiang_yijuidinfo($yiju, $yijuid){
        $data = [];
        if($yiju == 'none'){
            return $data;
        }
        if($yiju == 'cai'){
            $info = ContractCaiModel::where(['id'=>$yijuid])->find();
            $data['page'] = 'contract_cai';
            $data['money'] = $info['money'];
            $data['name'] = '支出合同-(金额：'.$info['money'].')';
        }
        if($yiju == 'caijie'){
            $info = ContractCaiJieModel::where(['id'=>$yijuid])->find();
            $data['page'] = 'contract_cai_jie';
            $data['money'] = $info['jingfee'];
            $data['name'] = '支出合同结算单-(金额：'.$info['jingfee'].')';
        }
        if($yiju == 'buy'){
            $info = ContractBuyModel::where(['id'=>$yijuid])->find();
            $data['page'] = 'contract_buy';
            $data['money'] = $info['money'];
            $data['name'] = '采购单-(金额：'.$info['money'].')';
        }
        if($yiju == 'stuffru'){
            $info = StuffRuModel::where(['id'=>$yijuid])->find();
            $data['page'] = 'stuff_ru';
            $data['money'] = $info['money'];
            $data['name'] = '入库单-(金额：'.$info['money'].')';
        }
        return $data;
    }
    public function get_zhi_xiang_piaoqing(){
        return [
            1=>'先票后款',
            2=>'先款后票',
            3=>'无票',
        ];
    }
    public function get_zhi_xiang_piaoqing_name($piaoqing){
        $arr = $this->get_zhi_xiang_piaoqing();
        return isset($arr[$piaoqing]) ? $arr[$piaoqing] : '';
    }









}
